package com.cloud.exceptions;

import com.cloud.rest.BaseEnumError;

/**
 * @ClassName: ReqParamException
 * @Description: 业务异常类
 * @Version: v1.0.0
 * @Author: yangyuwei
 * @Date: 2020/9/3
 * Modification History:
 * Date             Author      Version     Description
 * -------------------------------------------------------------
 * 2020/9/3      yangyuwei      v1.0.0      创建
 */
public class ReqParamException extends BaseRuntimeException {

    public static ReqParamException build(BaseEnumError error) {
        return new ReqParamException(error);
    }

    public static ReqParamException build(BaseEnumError error, Throwable cause) {
        return new ReqParamException(error, cause);
    }

    public ReqParamException(BaseEnumError error) {
        this(error, null);
    }

    public ReqParamException(BaseEnumError error, Throwable cause) {
        super(error, cause);
    }

    public static ReqParamException build(String msg) {
        return new ReqParamException(new BaseEnumError() {
            @Override
            public String getCode() {
                return "0001";
            }

            @Override
            public String getMsg() {
                return msg;
            }

            @Override
            public String getDetail() {
                return null;
            }
        }, null);
    }
}
